#pragma once

#include <stdint.h>

namespace modpash {

    struct DummyPinType {
        void set(bool level) {}
    };


    enum class address_type {
        none = 0,
        normal = 1,
        super,
        
        broadcast,
        secondary_broadcast,
    };

    // * 1:  读取线圈输出状态     REQ 5 REP N
    // * 2:  读取线圈输入状态     REQ 5 REP N
    // * 3:  读取保持寄存器       REQ 5 REP N
    // * 4:  读取输入寄存器       REQ 5 REP N
    // * 5:  写入单个线圈         REQ 5 REP 5
    // * 6:  写单个保持寄存器     REQ 5 REP 5
    // * 8:  诊断                 REQ 5 REP 5
    // * 11: 获取通信事件计数     REQ 1 REP 5
    // * 12: 获取通信事件记录     REQ 1 REP N
    // * 15: 写多个线圈           REQ N REP 5
    // * 16: 写多个保持寄存器     REQ N REP 5
    // * 17: 获取从站ID           REQ 1 REP N
    enum class function_code {
        read_coil_output = 1, 
        read_coil_input = 2,
        read_holding_registers = 3,
        read_input_registers = 4,
        write_coil = 5,
        write_register = 6,

        diagnose = 8,

        get_event_counter = 11,
        get_event_log = 12,

        write_multiple_coils = 15,
        write_multiple_registers = 16,

        report_device_id = 17,
    };

}  // namespace modpash